package com.ctsi.ssdc.admin.repository;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

import com.ctsi.ssdc.admin.domain.CscpRoleMenu;
import com.ctsi.ssdc.admin.domain.CscpRoleMenuExample;
import com.ctsi.ssdc.database.annotation.InjectByDataBaseType;
import com.ctsi.ssdc.database.enums.EnumDatabaseName;

/**
 * @author ctsi-biyi-generator
*/
@InjectByDataBaseType(includes= {EnumDatabaseName.ORACLE})
public interface CscpRoleMenuRepository extends com.ctsi.ssdc.repository.BaseRepository<CscpRoleMenu, Integer, CscpRoleMenuExample> {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table cscp_role_menu
     *
     * @mbg.generated Wed Feb 13 10:04:08 CST 2019
     */
    @SelectProvider(type=CscpRoleMenuSqlProvider.class, method="countByExample")
    long countByExample(CscpRoleMenuExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table cscp_role_menu
     *
     * @mbg.generated Wed Feb 13 10:04:08 CST 2019
     */
    @DeleteProvider(type=CscpRoleMenuSqlProvider.class, method="deleteByExample")
    int deleteByExample(CscpRoleMenuExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table cscp_role_menu
     *
     * @mbg.generated Wed Feb 13 10:04:08 CST 2019
     */
    @Delete({
        "delete from cscp_role_menu",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table cscp_role_menu
     *
     * @mbg.generated Wed Feb 13 10:04:08 CST 2019
     */
    @Insert({
        "insert into cscp_role_menu (role_id, menu_id)",
        "values (#{roleId,jdbcType=INTEGER}, #{menuId,jdbcType=INTEGER})"
    })
    @Options(useGeneratedKeys=true, keyProperty="id")
    int insert(CscpRoleMenu record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table cscp_role_menu
     *
     * @mbg.generated Wed Feb 13 10:04:08 CST 2019
     */
    @InsertProvider(type=CscpRoleMenuSqlProvider.class, method="insertSelective")
    @Options(useGeneratedKeys=true, keyProperty="id")
    int insertSelective(CscpRoleMenu record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table cscp_role_menu
     *
     * @mbg.generated Wed Feb 13 10:04:08 CST 2019
     */
    @SelectProvider(type=CscpRoleMenuSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="role_id", property="roleId", jdbcType=JdbcType.INTEGER),
        @Result(column="menu_id", property="menuId", jdbcType=JdbcType.INTEGER)
    })
    List<CscpRoleMenu> selectByExample(CscpRoleMenuExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table cscp_role_menu
     *
     * @mbg.generated Wed Feb 13 10:04:08 CST 2019
     */
    @Select({
        "select",
        "id, role_id, menu_id",
        "from cscp_role_menu",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="role_id", property="roleId", jdbcType=JdbcType.INTEGER),
        @Result(column="menu_id", property="menuId", jdbcType=JdbcType.INTEGER)
    })
    CscpRoleMenu selectByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table cscp_role_menu
     *
     * @mbg.generated Wed Feb 13 10:04:08 CST 2019
     */
    @UpdateProvider(type=CscpRoleMenuSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") CscpRoleMenu record, @Param("example") CscpRoleMenuExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table cscp_role_menu
     *
     * @mbg.generated Wed Feb 13 10:04:08 CST 2019
     */
    @UpdateProvider(type=CscpRoleMenuSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") CscpRoleMenu record, @Param("example") CscpRoleMenuExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table cscp_role_menu
     *
     * @mbg.generated Wed Feb 13 10:04:08 CST 2019
     */
    @UpdateProvider(type=CscpRoleMenuSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(CscpRoleMenu record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table cscp_role_menu
     *
     * @mbg.generated Wed Feb 13 10:04:08 CST 2019
     */
    @Update({
        "update cscp_role_menu",
        "set role_id = #{roleId,jdbcType=INTEGER},",
          "menu_id = #{menuId,jdbcType=INTEGER}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(CscpRoleMenu record);
}